<div class="panel panel-primary">
    <div class="panel-heading">
        <h3 class="panel-title">Caja de Gabinete</h3>
    </div>
    <div class="panel-body">
        <form class="form-horizontal" name="frmFotocopia" method="POST" role="form">
            <div class="form-group">
                <label for="txtDesde" class="col-sm-1 control-label">Desde</label>
                <div class="col-sm-5">
                    <div class="input-group">
                        <input type="text" class="form-control" id="txtDesde" name="txtDesde" placeholder="Desde" readonly="readonly">
                        <span class="input-group-btn">
                            <button id="btnDesde" class="btn btn-info" type="button">
                                <span class="glyphicon glyphicon-calendar"></span>
                            </button>
                        </span>
                    </div>
                </div>
                <label for="txtHasta" class="col-sm-1 control-label">Hasta</label>
                <div class="col-sm-5">
                    <div class="input-group">
                        <input type="text" class="form-control" id="txtHasta" name="txtHasta" placeholder="Hasta" readonly="readonly">
                        <span class="input-group-btn">
                            <button id="btnHasta" class="btn btn-info" type="button">
                                <span class="glyphicon glyphicon-calendar"></span>
                            </button>
                        </span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label for="selTurno" class="col-sm-1 control-label">Turno</label>
                <div class="col-sm-5">
                    <select id="ddlTurno" class="form-control" name="ddlTurno">
                        <option disabled="disabled" selected="selected">Seleccione un turno</option>
                        <option value="1">Mana&ntilde;a</option>
                        <option value="2">Tarde</option>
                    </select>
                </div>
                <label for="ddlEmpleado" class="col-sm-1 control-label">Empleado</label>
                <div class="col-sm-5">
                    <select id="ddlEmpleado" class="form-control" name="ddlEmpleado">
                        <option disabled="disabled" selected="selected">Seleccione un empleado</option>
                        {combo_empleado}
                    </select>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-10 col-sm-2">
                    <button type="submit" name="btnGenerar" class="btn btn-success">
                        <span class="glyphicon glyphicon-refresh"></span> Generar
                    </button>
                </div>
            </div>
        </form>
        <div class="well">
            <strong>Resultado:</strong> {Resultado}
        </div>
    </div>
</div>
<script type="text/javascript">
    var natDays = [{Feriados}];

    function noWeekendsOrHolidays(date) {
        var noWeekend = $.datepicker.noWeekends(date);
        if (noWeekend[0]) {
            return nationalDays(date);
        } else {
            return noWeekend;
        }
    }
    function nationalDays(date) {
        for (i = 0; i < natDays.length; i++) {
            if (date.getMonth() == natDays[i][0] - 1 && date.getDate() == natDays[i][1]) {
                return [false, natDays[i][2] + '_day'];
            }
        }
        return [true, ''];
    }
    function AddWeekDays(weekDaysToAdd) {
        var daysToAdd = 0;
        var mydate = new Date();
        var day = mydate.getDay();
        weekDaysToAdd = weekDaysToAdd - (5 - day);
        if ((5 - day) < weekDaysToAdd || weekDaysToAdd == 1) {
            daysToAdd = (5 - day) + 2 + daysToAdd;
        } else { // (5-day) >= weekDaysToAdd
            daysToAdd = (5 - day) + daysToAdd;
        }
        while (weekDaysToAdd != 0) {
            var week = weekDaysToAdd - 5;
            if (week > 0) {
                daysToAdd = 7 + daysToAdd;
                weekDaysToAdd = weekDaysToAdd - 5;
            } else { // week < 0
                daysToAdd = (5 + week) + daysToAdd;
                weekDaysToAdd = weekDaysToAdd - (5 + week);
            }
        }

        return daysToAdd;
    }

    $(function() {
        $("#txtDesde").datepicker({
            dateFormat: "yy-mm-dd",
            defaultDate: 0,
            changeMonth: true,
            changeYear: true,
            beforeShowDay: noWeekendsOrHolidays, //$.datepicker.noWeekends,
            onClose: function(selectedDate) {
                $("#txtHasta").datepicker("option", "minDate", selectedDate);
            }
        });
        $("#txtHasta").datepicker({
            dateFormat: "yy-mm-dd",
            defaultDate: 0,
            changeMonth: true,
            changeYear: true,
            beforeShowDay: noWeekendsOrHolidays, //$.datepicker.noWeekends,
            onClose: function(selectedDate) {
                $("#txtDesde").datepicker("option", "maxDate", selectedDate);
            }
        });

        $("#btnDesde").click(function() {
            $("#txtDesde").datepicker("show");
        });

        $("#btnHasta").click(function() {
            $("#txtHasta").datepicker("show");
        });
    });
</script>